package cn.wolfcode.wolf2w.cloud.feign;

import cn.wolfcode.wolf2w.cloud.feign.hystrix.UserInfoFeignHystrix;
import cn.wolfcode.wolf2w.cloud.member.domain.UserInfo;
import cn.wolfode.wolf2w.cloud.commom.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

//告诉对应的是哪个服务
@FeignClient(name="member-server",fallback = UserInfoFeignHystrix.class)
public interface UserInfoFeignApi {
    //RequestParam标签用了参数路径
   // @GetMapping("/users/get")
   // UserInfo get(@RequestParam("id") String id);
    //如果是对象用requestbody标签

    //@GetMapping("/users/get")
    // UserInfo get(@RequestBody UserInfo UserInfo);
   // 传单个参数


    @GetMapping("/users/get")
    //<>泛型用来区别
    //JsonResult<UserInfo> get(@RequestParam("id") String id);
    JsonResult get(@RequestParam("id") String id);

    @GetMapping("/users/checkPhone")
    JsonResult checkPhone(@RequestParam("phone") String phone);


    @GetMapping("/users/regist")
    //nickname可能为空RequestParam必须有数据，修改其可以没有值
    JsonResult regist(@RequestParam(value ="phone" ,required = false) String phone,
                      @RequestParam(value = "nickname",required = false) String nickname,
                      @RequestParam(value ="password" ,required = false) String password,
                      @RequestParam(value = "rpassword",required =false ) String rpassword
                      );

}
